<template>
  <div class="login-wrapper">
    <div class="logo"></div>
    <div class="login-picture__desc">
      <p class="login-picture__technoloy">TECHNOLOY<br/>BOOST FINANC</p>
      <P class="login-picture__boost">科技助力金融<br/>融先科技——领先的金融软件提供商</P>
    </div>
    <div class="login_area">
      <div class="login_title">登 录</div>
      <a-form-model ref="ruleForm" :model="form" :rules="rules" :label-col="labelCol" :wrapper-col="wrapperCol" class="login-form" autocomplete="off">
        <a-form-model-item prop="name">
          <a-input v-model="form.name" placeholder="账户">
            <a-icon slot="prefix" type="user" style="color: rgba(0, 0, 0, 0.25);" />
          </a-input>
        </a-form-model-item>
        <a-form-model-item prop="password">
          <a-input-password v-model="form.password" placeholder="密码" :suffix="''">
            <a-icon slot="prefix" type="lock" style="color: rgba(0, 0, 0, 0.25);" />
          </a-input-password>
        </a-form-model-item>
        <a-form-model-item>
          <a-checkbox-group>
            <a-checkbox @change="onChange">记住账户</a-checkbox>
          </a-checkbox-group>
        </a-form-model-item>
        <a-button type="primary" :loading="btnLoading" class="login-form-button" @click="onSubmit">登&nbsp;录</a-button>
      </a-form-model>
    </div>
  </div>
</template>
<script>
// import { setCookie, getCookie, delCookie } from '../../utils/cookie'
export default {
  name: 'login',
  data () {
    return {
      labelCol: { span: 0 },
      wrapperCol: { span: 24 },
      form: {
        name: '',
        password: ''
      },
      rememberCheck: false,
      btnLoading: false,
      rules: {
        name: [
          { required: true, message: '请输入账户!', trigger: 'blur' }
        ],
        password: [
          { required: true, message: '请输入密码!', trigger: 'blur' }
        ]
      }
    }
  },
  created () {
  },
  methods: {
    onChange (e) {
      this.rememberCheck = e.target.checked
    },
    onSubmit () {
      // window.parent.addTab({code: 'notify_test', url: '/notify/iframe?iframeSrc=https://www.baidu.com/'})
      this.$refs.ruleForm.validate(valid => {
        if (valid) {
          this.btnLoading = true
          const param = {
            name: this.form.name,
            password: this.form.password
          }
          this.api.get('/login', param).then(res => {
            this.btnLoading = false
            if (res.login) {
              console.log('登陆成功')
            }
          })
        }
      })
    }
  }
}
</script>
<style lang="scss" rel="stylesheet/scss" scoped>
.login-wrapper{
  background: url("../../assets/images/login-wrapper.jpg") no-repeat center;
  background-size: cover;
  width: 100%;
  min-height: 100%;
  height: 100%;
  text-align: left;
  .logo {
    background: url("../../assets/images/logo-login.png") no-repeat;
    position: absolute;
    left: 5%;
    top: 60px;
    background-size: 100% auto;
    width: 200px;
    height: 54px;
  }
  .login-picture__desc{
    width: 60%;
    height: 20%;
    position: absolute;
    bottom: 10%;
    left: 5%;
    color: #fff;
  }
  .login-picture__technoloy{
    font-size: 34px;
    line-height: 46px;
    margin-bottom:10px;
  }
  .login-picture__boost{
    font-size: 16px;
    line-height:26px;
    margin-top: 0px;
  }
  .login_area{
    background:rgba(255,255,255,1);
    width:390px;
    height:400px;
    position:absolute;
    right:15%;
    top:20%;
  }
  .login_title{
    text-align: center;
    margin-top:7%;
    font-size:20px;
  }
  /deep/ .ant-form label {
    font-size: 13px;;
  }
  .login-form {
    max-width: 280px;
    margin:30px auto 0 auto;
    .login-form-button {
      width: 100%;
      border-radius: 50px;
      height: 40px;
      font-size: 16px;
      border-radius: 50px;
      margin-top: 8px;
    }
    /deep/ .ant-input {
      height: 35px;
      border: none;
      border-radius: 0;
      border-bottom: 1px solid #ececec;
      font-size: 16px;
    }
    /deep/ .ant-form-item {
      margin-bottom: 12px;
    }
    /deep/ .ant-input-affix-wrapper:hover .ant-input {
      border-color: #ececec;
    }
    /deep/ .ant-input-suffix {
      display: none;
    }
    /deep/ .has-error .ant-form-explain {
      font-size: 13px;
    }
  }
}
</style>
